import type { TableColumn, FormField } from '@/components'
import { reactive } from 'vue'

export const fields = reactive<FormField[]>([
  {
    key: 'nickName',
    label: '姓名',
    tag: 'ElInput'
  },
  {
    key: 'workNo',
    label: '工号',
    tag: 'ElInput'
  },
  {
    key: 'sex',
    label: '性别',
    tag: 'MSelect',
    attrs: {
      options: [
        {
          label: '男',
          value: 0
        },
        {
          label: '女',
          value: 1
        }
      ]
    }
  },
  {
    key: 'roleId',
    label: '角色',
    tag: 'MSelect',
    attrs: {
      options: []
    }
  }
])

export const columns: TableColumn[] = [
  {
    key: 'nickName',
    label: '姓名'
  },
  {
    key: 'roleName',
    label: '角色'
  },
  {
    key: 'phoneNumber',
    label: '手机号'
  },
  {
    key: 'workNo',
    label: '工号'
  },
  {
    key: 'sex',
    label: '性别',
    slot: true
  },
  {
    key: 'unitName',
    label: '单位名称'
  },
  // {
  //   key: 'deptName',
  //   label: '部门'
  // },
  // {
  //   key: 'post',
  //   label: '职位'
  // },
  {
    key: 'actions',
    label: '操作',
    slot: true,
    fixed: 'right'
  }
]

export const dialogFields = reactive<FormField[]>([
  {
    key: 'roles',
    label: '角色',
    tag: 'MSelect',
    placeholder: '请选择（可多选）',
    attrs: {
      multiple: true,
      options: []
    },
    validateRules: [
      {
        required: true,
        message: '请选择',
        trigger: 'blur'
      }
    ]
  }
])
